<!--  -->
<template>
  <div class="tar-bar-item" @click="clickswitch">
    <div v-if="!flag"><slot name="item-icon"></slot></div>
    <div v-else><slot name="item-active"></slot></div>
    <div :class="{ changecolor: flag }"><slot name="item-text"></slot></div>
  </div>
</template>

<script>
export default {
  name: "tabbaritem",
  props: {
    way: {
      type: String,
    },
  },
  data() {
    return {
      //flag: true,
    };
  },
  methods: {
    clickswitch() {
      this.$router.replace(this.way);
    },
  },
  computed: {
    flag() {
      return this.$route.path.indexOf(this.way) !== -1;
    },
  },
};
</script>
<style scoped>
.tar-bar-item {
  flex: 1;
  text-align: center;
  height: 49px;
  background-color: #f6f6f6;
  font-size: 14px;
}
.tar-bar-item img {
  width: 24px;
  height: 24px;
  margin-top: 3px;
  vertical-align: middle;
  margin-bottom: 2px;
}
.changecolor {
  color: red;
}
</style>